package org.tinycloud.tinyjob.client.utils.secure;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

/**
 * <p>
 *
 * </p>
 *
 * @author liuxingyu01
 * @since 2025/10/13 21:41
 */
public class SecureUtils {
    public static Map<String, Object> genSecurityHeader(String accessToken) {
        Map<String, Object> headerMap = new HashMap<>();
        String nonce = UUID.randomUUID().toString().replace("-", "");
        String timestamp = String.valueOf(System.currentTimeMillis());
        String signature = HmacSha256Utils.hmac(accessToken, nonce + "#" + timestamp + "#");
        headerMap.put("nonce", nonce);
        headerMap.put("timestamp", timestamp);
        headerMap.put("signature", signature);
        return headerMap;
    }
}
